package com;

/**
 * Created by Chris
 */
public class Hero {
    private String name;
    private HairColor hairColor;
    private Weapon weapon;

    public String getName() {
        return name;
    }

    public HairColor getHairColor() {
        return hairColor;
    }

    public Weapon getWeapon() {
        return weapon;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(name);
        sb.append(" " + hairColor + " " + weapon);
        return sb.toString();
    }

    private Hero(HeroBuilder builder) {
        this.name = builder.name;
        this.hairColor = builder.hairColor;
        this.weapon = builder.weapon;
    }

    public static class HeroBuilder {
        private String name;
        private HairColor hairColor;
        private Weapon weapon;

        public HeroBuilder(String name) {
            this.name = name;
        }

        public HeroBuilder withHairColor(HairColor color) {
            this.hairColor = color;
            return this;
        }

        public HeroBuilder withWeapon(Weapon weapon) {
            this.weapon = weapon;
            return this;
        }

        public Hero build() {
            return new Hero(this);
        }
    }
}
